﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TPTecnicas.MessageProcessor.Common;
using TPTecnicas.MessageProcessor.Persistence;


namespace TPTecnicas.MessageProcessor.Persistence
{
	public class MailRepository : IRepository<MailDC>
	{
		SQLDataBaseContext Context;

		public MailRepository(SQLDataBaseContext context)
		{
			Context = context;
		}

		
		public void Add(MailDC entity)
		{
			Context.DataContext.MailDCs.InsertOnSubmit(entity);
			Commit();
		}

		public IEnumerable<MailDC> Where(System.Linq.Expressions.Expression<Func<MailDC, bool>> predicate)
		{
			throw new NotImplementedException();
		}

		public IEnumerable<MailDC> Get(System.Linq.Expressions.Expression<Func<MailDC, bool>> predicate)
		{
			throw new NotImplementedException();
		}

		public IEnumerable<MailDC> GetAll()
		{
			return Context.DataContext.MailDCs.ToList<MailDC>();
		}

		public MailDC First(System.Linq.Expressions.Expression<Func<MailDC, bool>> predicate)
		{
			throw new NotImplementedException();
		}

		public MailDC Find(params object[] keyValues)
		{
			throw new NotImplementedException();
		}

		public void Update(MailDC entity)
		{
			throw new NotImplementedException();
		}

		public void Delete(MailDC entity)
		{
			throw new NotImplementedException();
		}

		public void Detach(MailDC entity)
		{
			throw new NotImplementedException();
		}

		public void Commit()
		{
			try
			{
				Context.DataContext.SubmitChanges();
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
